package com.threeox.commonlibrary.entity.engine.model.multipage;

import android.widget.LinearLayout;

import com.threeox.commonlibrary.entity.engine.model.base.BaseModelMsg;
import com.threeox.utillibrary.util.EmptyUtils;
import com.threeox.utillibrary.util.res.IdHelper;
import com.threeox.utillibrary.util.res.LayoutHelper;
import com.threeox.utillibrary.util.res.StringHelper;

import java.util.List;

/**
 *
 * @ClassName: MultiPageMessage
 *
 * @Description: TODO(多页面模型对象)
 *
 * @author 赵屈犇
 *
 * @date 创建时间: 2017/8/10 13:29
 *
 * @version 1.0
 *
 */
public class MultiPageMessage extends BaseModelMsg {

    private Class contentViewClass;// 内容区域的view的类
    private String contentViewClassName;// 内容区域的view的类全名
    private Class navigationViewClass;// 导航栏view的类
    private String navigationViewClassName;// 导航栏view的类全名
    private Class indicatorViewClass;// 指示器view的类
    private String indicatorViewClassName;// 指示器view的类全名
    private NavigationDisplayPosition displayPosition = NavigationDisplayPosition.TOP;// 导航栏的显示位置
    private Integer navigationHeight = LinearLayout.LayoutParams.WRAP_CONTENT;// 导航栏的高度,默认为WRAP_CONTENT

    private Integer layoutId;// 布局的Id
    private String layoutName;// 布局的名称

    private List<PageDataMessage> pageDataMessages;

    @Override
    public void initData(StringHelper stringHelper, IdHelper idHelper, LayoutHelper layoutHelper) {
        super.initData(stringHelper, idHelper, layoutHelper);
        try {
            if (EmptyUtils.isNotEmpty(navigationViewClassName)) {
                this.navigationViewClassName = stringHelper.getStringText(navigationViewClassName);
                this.navigationViewClass = Class.forName(this.navigationViewClassName);
            }
            if (EmptyUtils.isNotEmpty(contentViewClassName)) {
                this.contentViewClassName = stringHelper.getStringText(contentViewClassName);
                this.contentViewClass = Class.forName(this.contentViewClassName);
            }
            if (EmptyUtils.isNotEmpty(indicatorViewClassName)) {
                this.indicatorViewClassName = stringHelper.getStringText(indicatorViewClassName);
                this.indicatorViewClass = Class.forName(this.indicatorViewClassName);
            }
            this.layoutId = layoutHelper.getLayoutId(layoutName);
        } catch (Exception e) {
        }
        if (EmptyUtils.isNotEmpty(pageDataMessages)) {
            for (PageDataMessage pageDataMessage: pageDataMessages) {
                pageDataMessage.initData(stringHelper, idHelper, indicatorViewClass);
            }
        }
    }

    public Class getContentViewClass() {
        return contentViewClass;
    }

    public void setContentViewClass(Class contentViewClass) {
        this.contentViewClass = contentViewClass;
    }

    public String getContentViewClassName() {
        return contentViewClassName;
    }

    public void setContentViewClassName(String contentViewClassName) {
        this.contentViewClassName = contentViewClassName;
    }

    public Class getIndicatorViewClass() {
        return indicatorViewClass;
    }

    public void setIndicatorViewClass(Class indicatorViewClass) {
        this.indicatorViewClass = indicatorViewClass;
    }

    public String getIndicatorViewClassName() {
        return indicatorViewClassName;
    }

    public void setIndicatorViewClassName(String indicatorViewClassName) {
        this.indicatorViewClassName = indicatorViewClassName;
    }

    public Class getNavigationViewClass() {
        return navigationViewClass;
    }

    public void setNavigationViewClass(Class navigationViewClass) {
        this.navigationViewClass = navigationViewClass;
    }

    public String getNavigationViewClassName() {
        return navigationViewClassName;
    }

    public void setNavigationViewClassName(String navigationViewClassName) {
        this.navigationViewClassName = navigationViewClassName;
    }

    public NavigationDisplayPosition getDisplayPosition() {
        return displayPosition;
    }

    public void setDisplayPosition(NavigationDisplayPosition displayPosition) {
        this.displayPosition = displayPosition;
    }

    public Integer getNavigationHeight() {
        return navigationHeight;
    }

    public void setNavigationHeight(Integer navigationHeight) {
        this.navigationHeight = navigationHeight;
    }

    public Integer getLayoutId() {
        return layoutId;
    }

    public void setLayoutId(Integer layoutId) {
        this.layoutId = layoutId;
    }

    public String getLayoutName() {
        return layoutName;
    }

    public void setLayoutName(String layoutName) {
        this.layoutName = layoutName;
    }

    public List<PageDataMessage> getPageDataMessages() {
        return pageDataMessages;
    }

    public void setPageDataMessages(List<PageDataMessage> pageDataMessages) {
        this.pageDataMessages = pageDataMessages;
    }
}
